<?php
namespace Home\Controller;
use Think\Controller;
class LoginController Extends Controller {
    public function index(){
        $this->display();
    }
    public function doLogin(){
        $user=D("User");
        if($user->create()){
            $data=$user->checkUserExits();
            if($data !== false){
                session('user',$data);
                cookie('name',$data['username']);
                $this->success("前台登录成功",U('Main/index'));
            }else{
                $this->error("用户名密码不一致");
            }
        }else{
            $this->error($user->getError());
        }
    }
}